﻿Shader "Unlit/Unlit"
{
    Properties
    {
        _BaseColor ("Color",Color) = (0.0, 1.0, 1.0, 1.0)
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100
        Pass
        {
            HLSLPROGRAM
            #pragma target 3.5
            #pragma multi_compile_instancing
            #pragma vertex vert
            #pragma fragment frag
            //#include "UnlitPass.hlsl"
            //float4 _BaseColor;
            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
            #include "UnityInput.hlsl"
            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl"

            CBUFFER_START(UnityPerMaterial)
                float4 _BaseColor;
            CBUFFER_END

            struct Attributes {
                float3 positionOS : POSITION;
                //UNITY_VERTEX_INPUT_INSTANCE_ID
            };
            struct Varyings {
                float4 positionCS : SV_POSITION;
                //UNITY_VERTEX_INPUT_INSTANCE_ID
            };




            Varyings vert(Attributes input)
            {
                Varyings o;
                //UNITY_SETUP_INSTANCE_ID(input);
                //UNITY_TRANSFER_INSTANCE_ID(input,o);
                //o.positionCS = TransformWorldToHClip(TransformObjectToWorld(input.positionOS));
                o.positionCS = mul(unity_MatrixVP, mul(unity_ObjectToWorld, float4(input.positionOS, 1.0)));
                return o;
            }

            float4 frag(Varyings input) : SV_Target
            {
                //UNITY_SETUP_INSTANCE_ID(input);
                return _BaseColor;
            }
            ENDHLSL
        }

        /*
        Pass
        {
            HLSLPROGRAM
            #pragma multi_compile_instancing
            #pragma vertex vert
            #pragma fragment frag
            //#include "UnlitPass.hlsl"
            //float4 _BaseColor;
            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
            #include "UnityInput.hlsl"
            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
            #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl"

            UNITY_INSTANCING_BUFFER_START(UnityPerMaterial)
                //	float4 _BaseColor;
                UNITY_DEFINE_INSTANCED_PROP(float4, _BaseColor)
            UNITY_INSTANCING_BUFFER_END(UnityPerMaterial)

            struct Attributes {
                float3 positionOS : POSITION;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };
            struct Varyings {
                float4 positionCS : SV_POSITION;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };



        
            Varyings vert (Attributes input )
            {
                Varyings o;
                UNITY_SETUP_INSTANCE_ID(input);
                UNITY_TRANSFER_INSTANCE_ID(input,o);
                o.positionCS = TransformWorldToHClip(TransformObjectToWorld(input.positionOS));
                return o;
            }

            float4 frag (Varyings input) : SV_Target
            {
                UNITY_SETUP_INSTANCE_ID(input);
                return UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial,_BaseColor);
            }
            ENDHLSL
        }
        */
    }
}
